<controls:ChildWindow
    x:Class="ibba.src.noriskbo.PageOperacao"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
    xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"	
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"    
    xmlns:local="clr-namespace:ibba.src.noriskbo"
    xmlns:slc="clr-namespace:ibba.src.sl.componentes;assembly=ibba.src.sl.componentes"
    xmlns:slr="clr-namespace:ibba.src.sl.recursos;assembly=ibba.src.sl.recursos"
    xmlns:slrv="clr-namespace:ibba.src.sl.recursos.Validations;assembly=ibba.src.sl.recursos"
    xmlns:dgPrimitives="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls.Data"
    mc:Ignorable="d"    
	Width="855" Height="610" FontSize="10.667" 
    Style="{StaticResource ChildWindowStyle}"
    Title="PageOperacao">

    <controls:ChildWindow.Resources>
        <local:ResolveStrings x:Key="ResolveStrings"/>
    </controls:ChildWindow.Resources>

    <Grid x:Name="LayoutRoot" Background="White" DataContext="{Binding}" Margin="0">
        <toolkit:BusyIndicator x:Name="favorAguardar">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="500" />
                    <RowDefinition Height="80" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>

                <Grid x:Name="grdColunaCentral" Grid.Row="0" Grid.RowSpan="2" Background="White">
                    <StackPanel x:Name="pnlCampos" Grid.Row="1" Margin="0,0,0,0">
                        <Border CornerRadius="10,0,0,0" BorderThickness="1" BorderBrush="#FF5A7194" Background="#FFE7E9EC" Padding="3" Margin="0,0,0,10">
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="Grupo:" FontWeight="Bold" FontSize="12"/>
                                <TextBlock x:Name="lblGrupo" Text="{Binding Path=operacao.NomeGrupo, Mode=OneWay}" Width="385" FontSize="12" Margin="3,0" />

                                <TextBlock Text="Origem:" FontWeight="Bold" FontSize="12" Margin="10,0,0,0"/>
                                <TextBlock x:Name="lblOrigem" Text="{Binding Path=operacao.DescricaoOrigem, Mode=OneWay}" Width="80" FontSize="12" Margin="3,0" />

                                <TextBlock Text="Status:" FontWeight="Bold" FontSize="12" Margin="10,0,0,0"/>
                                <TextBlock x:Name="lblDescricaoStatus" Text="{Binding Path=operacao.Status, Mode=OneWay}" Width="160" FontSize="12" Margin="3,0" />
                            </StackPanel>
                        </Border>

                        <Grid x:Name="grdCampos" DataContext="{Binding}">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition/>
                                <ColumnDefinition/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="182"/>
                                <RowDefinition Height="238" />
                                <RowDefinition />
                            </Grid.RowDefinitions>

                            <StackPanel Grid.RowSpan="2">
                                <Border x:Name="brdPrincipal" CornerRadius="5,5,5,5" BorderThickness="1" BorderBrush="#FF5A7194"
                                        Background="WhiteSmoke">
                                    <!--Background="#FFE7E9EC">-->
                                    <StackPanel>
                                        <Grid x:Name="gridColuna0" Margin="5,5,5,18" Background="{x:Null}">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="90"/>
                                                <ColumnDefinition MinWidth="200"/>
                                            </Grid.ColumnDefinitions>
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="25"/>
                                                <RowDefinition Height="25"/>
                                                <RowDefinition Height="25"/>
                                                <RowDefinition Height="25"/>
                                            </Grid.RowDefinitions>

                                            <slrv:ValidationManager x:Name="validatorManager" />

                                            <TextBlock Text="Contrato" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" FontWeight="Bold" />
                                            <TextBox x:Name="txtContrato" Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left"
                                                     Height="22" Width="200" MaxLength="20" 
                                                     Text="{Binding Path=operacao.CodigoContrato, Mode=TwoWay}"
                                                     TextChanged="txtContrato_TextChanged"
                                                     LostFocus="txtContrato_LostFocus"/>

                                            <TextBlock Text="Cliente" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" FontWeight="Bold" />
                                            <slr:AutoCompleteBoxFix x:Name="txtCliente" Grid.Row="1" Grid.Column="1"
                                                                    VerticalAlignment="Center" HorizontalAlignment="Left"
                                                                    Height="22" Width="200" Margin="0,2"
                                                                    IsTextCompletionEnabled="True" MinimumPrefixLength="2"
                                                                    ValueMemberPath="NomeCliente"
                                                                    ItemTemplate="{StaticResource DataTemplateCliente}"
                                                                    SelectionChanged="txtCliente_SelectionChanged" />
                                            <!--<sdk:AutoCompleteBox.ItemTemplate>
                                                    <DataTemplate>
                                                        <StackPanel Orientation="Vertical" MinWidth="{Binding Path=Width, ElementName=txtCliente}" Margin="0,0,20,0">
                                                            <TextBlock Text="{Binding Path=NomeCliente}" />
                                                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                                                                <TextBlock Text="{Binding Path=CnpjCpf, Converter={StaticResource FormatCnpjCpfConverter}}" FontSize="9" Foreground="Blue" />
                                                                <TextBlock Text=" | Id: " FontSize="9" Foreground="Black" Margin="10,0" />
                                                                <TextBlock Text="{Binding Path=IdCliente}" FontSize="9" Foreground="Blue"/>
                                                            </StackPanel>
                                                        </StackPanel>
                                                    </DataTemplate>
                                                </sdk:AutoCompleteBox.ItemTemplate>
                                            </slr:AutoCompleteBoxFix>-->

                                            <TextBlock Text="Produto" Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" FontWeight="Bold" />
                                            <slr:AutoCompleteBoxFix x:Name="txtProduto" Grid.Row="2" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left" 
                                                                 Height="22" Width="200" 
                                                                 SelectionChanged="txtProduto_SelectionChanged"
                                                                 SelectedItem="{Binding Path=cd_Produto, Mode=TwoWay}"/>
                                            <!--
                                                <sdk:AutoCompleteBox.ItemTemplate>
                                            <DataTemplate>
                                                <StackPanel Orientation="Vertical" MinWidth="{Binding Path=Width, ElementName=txtProduto}">
                                                    <TextBlock Text="{Binding Path=cd_Produto, Mode=TwoWay}" />
                                                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                                                        <TextBlock Text="{Binding Path=dsProduto, Mode=TwoWay}" FontSize="9" Foreground="Blue" Margin="5,0,20,0"/>
                                                    </StackPanel>
                                                </StackPanel>
                                            </DataTemplate>
                                        </sdk:AutoCompleteBox.ItemTemplate>
                                    </slr:AutoCompleteBoxFix> -->

                                            <TextBlock Text="Modalidade" Grid.Row="3" Grid.Column="0" VerticalAlignment="Center" FontWeight="Bold" />
                                            <ComboBox x:Name="cboModalidade" Grid.Row="3" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left" 
                                                      Height="22" Width="200" 
                                                      SelectedItem="{Binding Path=IdProdutoRisco, Mode=TwoWay}"                                                      
                                                      SelectionChanged="cboModalidade_SelectionChanged" 
                                                      DisplayMemberPath="cd_Modalidade" />
                                            <!-- 

                                                <ComboBox.ItemTemplate >
                                                    <DataTemplate>
                                                        <StackPanel Orientation="Vertical" MinWidth="{Binding Path=Width, ElementName=cboModalidade}">
                                                            <TextBlock Text="{Binding Mode=TwoWay, Path=cd_Modalidade}"/>
                                                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                                                                <TextBlock Text="{Binding Mode=TwoWay, Path=dsModalidade}" FontSize="8" Foreground="Blue" Margin="5,0,20,0"/>
                                                            </StackPanel>
                                                        </StackPanel>
                                                    </DataTemplate>
                                                </ComboBox.ItemTemplate>
                                                
                                            </ComboBox> -->


                                        </Grid>
                                    </StackPanel>
                                </Border>
                                <Border Margin="0,-16,0,0" CornerRadius="0,0,5,5" BorderThickness="1,0,1,1" BorderBrush="#FF5A7194"
                                        Background="#DEE5E5E5">
                                    <!--Background="#FFCBD6E2">-->
                                    <TextBlock Name="txtDuplicidade" FontSize="10" HorizontalAlignment="Stretch" Foreground="#FFE13511" TextAlignment="Center" />
                                </Border>

                                <Border CornerRadius="5,5,5,5" BorderThickness="1" BorderBrush="#FF5A7194" Margin="0,2,0,0">
                                    <StackPanel>
                                        <Grid Margin="5" Background="White">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="90"/>
                                                <ColumnDefinition MinWidth="200"/>
                                            </Grid.ColumnDefinitions>
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="25"/>
                                                <RowDefinition Height="25"/>
                                                <RowDefinition Height="25"/>
                                                <RowDefinition Height="25"/>
                                                <RowDefinition Height="25"/>
                                                <RowDefinition Height="18"/>
                                                <RowDefinition Height="18"/>
                                                <RowDefinition Height="25"/>
                                                <RowDefinition Height="25"/>
                                            </Grid.RowDefinitions>

                                            <TextBlock Text="{Binding StringLibrary.Veiculo, Source={StaticResource ResolveStrings}, StringFormat='\{0\} Legal' }"
                                                       Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" FontWeight="Bold" />
                                            <slr:AutoCompleteBoxFix x:Name="txtVeiculo" Grid.Row="0" Grid.Column="1" 
                                                                    VerticalAlignment="Center" HorizontalAlignment="Left" 
                                                                    HorizontalContentAlignment="Left"
                                                                    Height="22" Width="200"
                                                                    IsTextCompletionEnabled="True" MinimumPrefixLength="2"  
                                                                    SelectedItem="{Binding Path=IdEmpresa, Mode=TwoWay}"
                                                                    ValueMemberBinding="{Binding Path=NomeEmpresa}">
                                                <sdk:AutoCompleteBox.ItemTemplate>
                                                    <DataTemplate>
                                                        <Grid Width="196">
                                                            <StackPanel Orientation="Horizontal">
                                                                <TextBlock Text="{Binding NomeEmpresa}" Margin="0,0,5,0" />
                                                            </StackPanel>
                                                        </Grid>
                                                    </DataTemplate>
                                                </sdk:AutoCompleteBox.ItemTemplate>
                                            </slr:AutoCompleteBoxFix>

                                            <TextBlock Text="Tipo Sublimite" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" FontWeight="Bold" />
                                            <ComboBox x:Name="cboAreaSubLimite" Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left" 
                                                      Height="22" Width="200" 
                                                      SelectedItem="{Binding Path=IdSubAreaInslCred, Mode=TwoWay}" 
                                                      Grid.ColumnSpan="2" Margin="0,2">                            
                                                <ComboBox.ItemTemplate>
                                                    <DataTemplate>
                                                        <StackPanel Orientation="Vertical" MinWidth="150" Margin="0,1,10,1">
                                                            <TextBlock >
                                                                <Run Text="{Binding Path=DescricaoSubArea}"/>
                                                                <Run Text="{Binding Path=DescricaoArea, StringFormat='\ ({0\})'}" FontSize="9" Foreground="{StaticResource ColorDetailCombo}"/>                                                                
                                                            </TextBlock>
                                                            <StackPanel Orientation="Vertical" HorizontalAlignment="Right">
                                                                <TextBlock FontSize="9" Foreground="{StaticResource ColorDetailCombo}" HorizontalAlignment="Right">
                                                                    <Run Text="Id: " Foreground="Black"/>
                                                                    <Run Text="{Binding Path=IdSubAreaInslCred}" />
                                                                </TextBlock>                                                                
                                                                <Border Style="{StaticResource LineBlue}" Width="150" Margin="0,2" HorizontalAlignment="Center"/>
                                                            </StackPanel>                                                            
                                                        </StackPanel>
                                                    </DataTemplate>
                                                </ComboBox.ItemTemplate>
                                            </ComboBox>

                                            <TextBlock Text="{Binding StringLibrary.Negociacao, Source={StaticResource ResolveStrings}}" Grid.Row="2" Grid.Column="0" VerticalAlignment="Center"  />
                                            <sdk:DatePicker x:Name="dpDtNegociacao" Grid.Row="2" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left"
                                                            Height="22" Width="130">
                                                <!--Text="{Binding Path=detalheOperacao.DataNegociacao, Mode=TwoWay, ValidatesOnDataErrors=True, NotifyOnValidationError=True, Converter={StaticResource DateTimeConverter}}"
                                                            CalendarClosed="dpDtNegociacao_CalendarClosed"
                                                            LostFocus="dpDtNegociacao_LostFocus">-->
                                            </sdk:DatePicker>

                                            <TextBlock Text="Abertura" Grid.Row="3" Grid.Column="0" VerticalAlignment="Center"  FontWeight="Bold" />
                                            <sdk:DatePicker x:Name="dpDtAbertura" Grid.Row="3" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left"
                                                            Height="22" Width="130">
                                                <!--Text="{Binding Path=operacao.DataAbertura, Mode=TwoWay, ValidatesOnDataErrors=True, NotifyOnValidationError=True, Converter={StaticResource DateTimeConverter}}"
                                                    CalendarClosed="dpDtAbertura_CalendarClosed"
                                                    LostFocus="dpDtAbertura_LostFocus">-->
                                                <slrv:ValidationService.Validator>
                                                    <slrv:RequiredValidation ManagerName="validatorManager" IsRequired="True" />
                                                </slrv:ValidationService.Validator>
                                            </sdk:DatePicker>

                                            <TextBlock Text="Vencimento" Grid.Row="4" Grid.Column="0" VerticalAlignment="Center" FontWeight="Bold" />
                                            <sdk:DatePicker x:Name="dpDtVencimento" Grid.Row="4" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left" 
                                                            Height="22" Width="130" >
                                                <!--Text="{Binding Path=operacao.DataVencimento, Mode=TwoWay, Converter={StaticResource DateTimeConverter}}"
                                                    CalendarClosed="dpDtVencimento_CalendarClosed"
                                                    LostFocus="dpDtVencimento_LostFocus"  />-->

                                                <slrv:ValidationService.Validator>
                                                    <slrv:RequiredValidation ManagerName="validatorManager" IsRequired="True" />
                                                </slrv:ValidationService.Validator>
                                            </sdk:DatePicker>

                                            <CheckBox x:Name="chkBaixaVencimento" Grid.Row="5" Grid.Column="1" VerticalAlignment="Center" Content="Baixar no Vencimento"                                                       
                                                      Checked="chkBaixaVencimento_Checked" />

                                            <CheckBox x:Name="chkSobrepoeAutomatica" Grid.Row="6" Grid.Column="1" VerticalAlignment="Center" 
                                                      Checked="chkSobrepoeAutomatica_Checked" >
                                                <CheckBox.Content>
                                                    <TextBlock>
                                                        <Run Text="Sobrepor a "/>
                                                        <Run Text="{Binding StringLibrary.Operacao, Source={StaticResource ResolveStrings}, StringFormat='\{0\} '}"/>
                                                        <Run Text="{Binding StringLibrary.Automatica, Source={StaticResource ResolveStrings}}"/>
                                                    </TextBlock>
                                                </CheckBox.Content>
                                            </CheckBox>

                                            <TextBlock Text="Pagamento" Grid.Row="7" Grid.Column="0" VerticalAlignment="Center" />
                                            <sdk:DatePicker x:Name="dpDtPagamento" Grid.Row="7" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left"
                                                            Height="22" Width="130" />
                                            <!--Text="{Binding Path=detalheOperacao.DataPagamento, Mode=TwoWay, Converter={StaticResource DateTimeConverter}}"
                                                    CalendarClosed="dpDtPagamento_CalendarClosed"
                                                    LostFocus="dpDtPagamento_LostFocus"/>-->

                                            <TextBlock Text="{Binding StringLibrary.Titulo, Source={StaticResource ResolveStrings}}" Grid.Row="8" Grid.Column="0" VerticalAlignment="Center" />
                                            <TextBox x:Name="txtTitulo" Grid.Row="8" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left"
                                                     Height="22" Width="200" MaxLength="30"                                                     
                                                     GotFocus="TextBox_GotFocus"
                                                     TextChanged="txtTitulo_TextChanged"/>
                                        </Grid>
                                    </StackPanel>
                                </Border>

                                <Border x:Name="brdContaCorrente" CornerRadius="5,5,5,5" BorderThickness="1" BorderBrush="#FF5A7194" Margin="0,8,0,0">
                                    <StackPanel>
                                        <Grid Margin="5" Background="White">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="90"/>
                                                <ColumnDefinition MinWidth="200"/>
                                            </Grid.ColumnDefinitions>
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="25"/>
                                                <RowDefinition Height="25"/>
                                            </Grid.RowDefinitions>

                                            <TextBlock Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" Text="{Binding StringLibrary.Agencia, Source={StaticResource ResolveStrings}}"/>
                                            <TextBox x:Name="txtAgencia" Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left" 
                                                     Height="22" Width="130" MaxLength="9" 
                                                     slrv:TextBoxFilterService.Filter="Integer"                                                     
                                                     GotFocus="TextBox_GotFocus"
                                                     TextChanged="txtAgencia_TextChanged"/>

                                            <TextBlock Text="Conta" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center"/>
                                            <TextBox x:Name="txtConta" Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left" 
                                                     Height="22" Width="130" MaxLength="9" 
                                                     slrv:TextBoxFilterService.Filter="Integer"                                                     
                                                     GotFocus="TextBox_GotFocus"
                                                     TextChanged="txtConta_TextChanged"/>
                                        </Grid>
                                    </StackPanel>
                                </Border>
                                <Grid Margin="10,-70,0,0" Background="White" VerticalAlignment="Top" HorizontalAlignment="Left">
                                    <TextBlock HorizontalAlignment="Left" Margin="2,0,2,0" Text="{Binding StringLibrary.Operacao, Source={StaticResource ResolveStrings}, StringFormat='\{0\} de Conta Corrente' }"/>
                                </Grid>

                            </StackPanel>

                            <Grid Margin="10,-8,0,0" Background="White" VerticalAlignment="Top" HorizontalAlignment="Left" Grid.Row="0" Grid.Column="0" >
                                <TextBlock Text="{Binding StringLibrary.Operacao, Source={StaticResource ResolveStrings}, StringFormat='Chave da \{0\}' }" 
                                           HorizontalAlignment="Left" Margin="2,0,2,0" />
                            </Grid>

                            <Grid x:Name="gridCamposLadoDireito" Grid.Row="0" Grid.Column="1">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition/>
                                    <ColumnDefinition/>
                                </Grid.ColumnDefinitions>

                                <Border x:Name="brdValores" CornerRadius="5,5,5,5" BorderThickness="1" BorderBrush="#FF5A7194" Grid.Column="0" Margin="5,0,0,0">
                                    <StackPanel>
                                        <Grid Margin="5" Background="White">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition MinWidth="115"/>
                                                <ColumnDefinition MinWidth="130"/>
                                            </Grid.ColumnDefinitions>
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="25"/>
                                                <RowDefinition Height="18"/>
                                                <RowDefinition Height="25"/>
                                                <RowDefinition Height="18"/>
                                                <RowDefinition Height="25"/>
                                                <RowDefinition Height="18"/>
                                                <RowDefinition Height="25"/>
                                                <RowDefinition Height="18"/>
                                            </Grid.RowDefinitions>

                                            <TextBlock Text="Moeda" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" FontWeight="Bold" />
                                            <slr:AutoCompleteBoxFix x:Name="cboMoeda" Grid.Row="0" Grid.Column="1" 
                                                                    Height="22" Width="128" 
                                                                    IsTextCompletionEnabled="True"
                                                                    VerticalAlignment="Center" HorizontalAlignment="Right"
                                                                    ValueMemberPath="cd_Moeda"
                                                                    ItemTemplate="{StaticResource DataTemplateMoeda}"
                                                                    SelectionChanged="cboMoeda_SelectionChanged" />
                                            <!--<sdk:AutoCompleteBox.ItemTemplate>
                                                    <DataTemplate>
                                                        <StackPanel Orientation="Vertical" Width="200" Margin="0,0,20,0" >
                                                            <TextBlock Text="{Binding Mode=TwoWay, Path=cd_Moeda}"/>
                                                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                                                                <TextBlock Text="{Binding Mode=TwoWay, Path=nm_Moeda}" FontSize="9" Foreground="Blue" />
                                                                <TextBlock Text=":" FontSize="9" Foreground="Blue" Margin="10,0"/>
                                                                <TextBlock Text="{Binding Mode=TwoWay, Path=ValorCotacao}" FontSize="9" Foreground="Blue"/>
                                                            </StackPanel>
                                                        </StackPanel>
                                                    </DataTemplate>
                                                </sdk:AutoCompleteBox.ItemTemplate>
                                            </slr:AutoCompleteBoxFix>-->
                                            <StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Top" HorizontalAlignment="Right" >
                                                <TextBlock Foreground="DarkGoldenrod" FontSize="9.333" FontWeight="Bold" 
                                                           Text="{Binding StringLibrary.Cotacao, Source={StaticResource ResolveStrings}, StringFormat='\{0\} D-1:' }" />
                                                <TextBlock x:Name="lblCotacao" Foreground="DarkGoldenrod" FontSize="9.333" FontWeight="Bold" Margin="5,0,0,0" />
                                            </StackPanel>

                                            <TextBlock Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" FontWeight="Bold" 
                                                       Text="{Binding StringLibrary.Operacao, Source={StaticResource ResolveStrings}}"/>
                                            <TextBox x:Name="txtVLOperacaoMoeda" Grid.Row="2" Grid.Column="1"
                                                     VerticalAlignment="Center" HorizontalAlignment="Right" TextAlignment="Right"
                                                     Height="22" Width="128" MaxLength="15"
                                                     slrv:TextBoxFilterService.Filter="Decimal"
                                                     SelectionChanged="txtVLOperacaoMoeda_SelectionChanged"
                                                     Text="{Binding Path=operacao.ValorOperacao, Mode=TwoWay, Converter={StaticResource DecimalConverter}}"
                                                     GotFocus="TextBox_GotFocus" />
                                            <StackPanel Orientation="Horizontal" Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Top" HorizontalAlignment="right" >
                                                <TextBlock Text="BRL:" Foreground="DarkGoldenrod" FontSize="9.333" FontWeight="Bold" />
                                                <TextBlock x:Name="lblValorOperacaoEmReais" Foreground="DarkGoldenrod" FontSize="9.333" FontWeight="Bold" Margin="5,0,0,0" />
                                            </StackPanel>

                                            <TextBlock Grid.Row="4" Grid.Column="0" VerticalAlignment="Center" FontWeight="Bold" 
                                                       Text="{Binding StringLibrary.Contabil, Source={StaticResource ResolveStrings}}"/>
                                            <TextBox x:Name="txtVLContabilMoeda" Grid.Row="4" Grid.Column="1" 
                                                     VerticalAlignment="Center" HorizontalAlignment="Right" TextAlignment="Right"
                                                     Height="22" Width="128" MaxLength="15"
                                                     slrv:TextBoxFilterService.Filter="Decimal"
                                                     SelectionChanged="txtVLContabilMoeda_SelectionChanged"
                                                     Text="{Binding Path=operacao.ValorContabil, Mode=TwoWay, Converter={StaticResource DecimalConverter}}"
                                                     GotFocus="TextBox_GotFocus">

                                            </TextBox>
                                            <StackPanel Orientation="Horizontal" Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Top" HorizontalAlignment="Right" >
                                                <TextBlock Text="BRL:" Foreground="DarkGoldenrod" FontSize="9.333" FontWeight="Bold" />
                                                <TextBlock x:Name="lblValorContabilEmReais" Foreground="DarkGoldenrod" FontSize="9.333" FontWeight="Bold" Margin="5,0,0,0" />
                                            </StackPanel>

                                            <TextBlock Text="Saldo comprometido" Grid.Row="6" Grid.Column="0" VerticalAlignment="Center" />
                                            <TextBox x:Name="txtVLComprometidoMoeda" Grid.Row="6" Grid.Column="1" 
                                                     VerticalAlignment="Center" HorizontalAlignment="Right" TextAlignment="Right" 
                                                     Height="22" Width="128" MaxLength="15" 
                                                     slrv:TextBoxFilterService.Filter="Decimal"
                                                     SelectionChanged="txtVLComprometidoMoeda_SelectionChanged"                                                     
                                                     GotFocus="TextBox_GotFocus" LostFocus="TextBoxValor_LostFocus" 
                                                     Text="{Binding detalheOperacao.SaldoComprometido, Mode=TwoWay, Converter={StaticResource DecimalConverter}}"/>
                                            <StackPanel Orientation="Horizontal" Grid.Row="7" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Top" HorizontalAlignment="Right" >
                                                <TextBlock Text="BRL:" Foreground="DarkGoldenrod" FontSize="9.333" FontWeight="Bold" />
                                                <TextBlock x:Name="lblValorComprometidoEmReais" Foreground="DarkGoldenrod" FontSize="9.333" FontWeight="Bold" Margin="5,0,0,0" />
                                            </StackPanel>
                                        </Grid>
                                    </StackPanel>
                                </Border>
                                <Grid Margin="10,-8,0,0" Background="White" VerticalAlignment="Top" HorizontalAlignment="Left" Grid.Row="0" Grid.Column="0" >
                                    <TextBlock x:Name="lblTituloFrameValores" Text="Valores" HorizontalAlignment="Left" Margin="2,0,2,0" />
                                </Grid>

                                <Border x:Name="brdOpcoes" CornerRadius="5,5,5,5" BorderThickness="1" BorderBrush="#FF5A7194" Grid.Column="1" Margin="5,0,0,0">
                                    <StackPanel>
                                        <Grid Margin="5" Background="White">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition MinWidth="100"/>
                                                <ColumnDefinition MinWidth="130"/>
                                            </Grid.ColumnDefinitions>
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="28"/>
                                                <RowDefinition Height="28"/>
                                                <RowDefinition Height="28"/>
                                                <RowDefinition Height="28"/>
                                                <RowDefinition Height="28"/>
                                                <RowDefinition Height="28"/>
                                            </Grid.RowDefinitions>

                                            <TextBlock Text="Tipo de mercado" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center"/>

                                            <ComboBox x:Name="cboTipoMercado" Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Right"
                                                      Height="22" Width="128" 
                                                      SelectedItem="{Binding Path=detalheOperacao.CodigoTipoMercado, Mode=TwoWay, ValidatesOnDataErrors=False, NotifyOnValidationError=True}"
                                                      DisplayMemberPath="DescricaoTipoMercado" 
                                                      SelectionChanged="cboTipoMercado_SelectionChanged" />

                                            <TextBlock Text="Ativo relacionado" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" />
                                            <TextBox x:Name="txtAtivoRelacionado" Grid.Row="1" Grid.Column="1"
                                                     VerticalAlignment="Center" HorizontalAlignment="Right" TextAlignment="Right"
                                                     Height="22" Width="128" MaxLength="10" 
                                                     GotFocus="TextBox_GotFocus"
                                                     TextChanged="txtAtivoRelacionado_TextChanged"/>

                                            <TextBlock Grid.Row="2" Grid.Column="0" VerticalAlignment="Center"
                                                       Text="{Binding StringLibrary.exercicio, Source={StaticResource ResolveStrings}, StringFormat='Valor \{0\}' }"/>
                                            <TextBox x:Name="txtVLExercicio" Grid.Row="2" Grid.Column="1" 
                                                     VerticalAlignment="Center" HorizontalAlignment="Right" TextAlignment="Right"
                                                     Height="22" Width="128" MaxLength="15" 
                                                     slrv:TextBoxFilterService.Filter="Decimal"
                                                     GotFocus="TextBox_GotFocus" LostFocus="TextBoxValor_LostFocus" 
                                                     Text="{Binding detalheOperacao.ValorExercicio, Mode=TwoWay, Converter={StaticResource DecimalConverter}}"/>

                                            <TextBlock Grid.Row="3" Grid.Column="0" VerticalAlignment="Center"
                                                       Text="{Binding StringLibrary.premio, Source={StaticResource ResolveStrings}, StringFormat='Valor \{0\}' }"/>

                                            <TextBox x:Name="txtVLPremio" Grid.Row="3" Grid.Column="1" 
                                                     VerticalAlignment="Center" HorizontalAlignment="Right" TextAlignment="Right"
                                                     Height="22" Width="128" MaxLength="15" 
                                                     slrv:TextBoxFilterService.Filter="Decimal" 
                                                     GotFocus="TextBox_GotFocus" LostFocus="TextBoxValor_LostFocus" 
                                                     Text="{Binding detalheOperacao.ValorPremio, Mode=TwoWay, Converter={StaticResource DecimalConverter}}"/>

                                            <TextBlock Text="Qtd. de lotes" Grid.Row="4" Grid.Column="0" VerticalAlignment="Center"/>
                                            <TextBox x:Name="txtQtLotes" Grid.Row="4" Grid.Column="1" 
                                                     Height="22" Width="128" HorizontalAlignment="Right" MaxLength="4" TextAlignment="Right" 
                                                     slrv:TextBoxFilterService.Filter="Integer"
                                                     GotFocus="TextBox_GotFocus"
                                                     TextChanged="txtQtLotes_TextChanged"/>

                                            <TextBlock Grid.Row="5" Grid.Column="0" VerticalAlignment="Center">
                                                <Run Text="{Binding StringLibrary.Opcoes, Source={StaticResource ResolveStrings}, StringFormat='Qtd. de \{0\}'}" />
                                                <LineBreak/>
                                                <Run Text="por lote" FontSize="9" Foreground="DarkGoldenrod" />
                                            </TextBlock>

                                            <TextBox x:Name="txtQtOpcoesLotes" Grid.Row="5" Grid.Column="1" 
                                                     HorizontalAlignment="Right" TextAlignment="Right" 
                                                     Height="22" Width="128" MaxLength="4" 
                                                     slrv:TextBoxFilterService.Filter="Integer"
                                                     GotFocus="TextBox_GotFocus"
                                                     TextChanged="txtQtOpcoesLotes_TextChanged"/>
                                        </Grid>
                                    </StackPanel>
                                </Border>
                                <Grid Margin="10,-8,0,0" Background="White" VerticalAlignment="Top" HorizontalAlignment="Left" Grid.Column="1" >
                                    <TextBlock x:Name="lblTituloFrameOpcoes" HorizontalAlignment="Left" Margin="2,0,2,0" 
                                               Text="{Binding StringLibrary.Opcoes, Source={StaticResource ResolveStrings}}"/>
                                </Grid>
                            </Grid>

                            <Grid x:Name="gridCDSCurvas" Grid.Row="1" Grid.Column="1">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition/>
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="*" />
                                </Grid.RowDefinitions>

                                <!-- Campos CDS -->
                                <Grid x:Name="gridCDS" Grid.Row="0" Grid.Column="0" Margin="5,10,0,0" >
                                    <Border x:Name="brdCDS" Height="72" VerticalAlignment="Top" CornerRadius="5,5,5,5" BorderThickness="1" BorderBrush="#FF5A7194" Grid.Column="0" Grid.Row="0">
                                        <StackPanel>
                                            <Grid Margin="5" Background="White">
                                                <Grid.RowDefinitions>
                                                    <RowDefinition Height="30" />
                                                    <RowDefinition Height="30" />
                                                </Grid.RowDefinitions>
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="234" />
                                                    <ColumnDefinition />
                                                </Grid.ColumnDefinitions>
                                                <TextBlock Text="Upfront Fee" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" Margin="0,0,0,0" />
                                                <TextBox x:Name="txtVLUpfrontFee" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,0,0" TextAlignment="Right" Height="22" Width="128" MaxLength="15" slrv:TextBoxFilterService.Filter="Decimal" Text="{Binding Path=operacao.ValorUpfrontFee, Mode=TwoWay, Converter={StaticResource DecimalConverter}}" GotFocus="TextBox_GotFocus" />
                                                <TextBlock Text="Independent Amount" Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" Margin="14,0,0,0" />
                                                <TextBox x:Name="txtVLIndependentAmount" Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,0,0" TextAlignment="Right" Height="22" Width="125" MaxLength="15" slrv:TextBoxFilterService.Filter="Decimal" Text="{Binding Path=operacao.ValorIndependentAmount, Mode=TwoWay, Converter={StaticResource DecimalConverter}}" GotFocus="TextBox_GotFocus" />
                                                <TextBlock Text="Reference Entity" Grid.Row="1" Grid.ColumnSpan="2" VerticalAlignment="Center" Margin="0,0,0,0" FontWeight="Bold" />
                                                <slr:AutoCompleteBoxFix x:Name="txtEntidadeReferencia" Grid.Row="1" Grid.ColumnSpan="2" VerticalAlignment="Center" HorizontalAlignment="Right" Height="22" Width="390" Margin="0,0,0,0" IsTextCompletionEnabled="True" MinimumPrefixLength="2" ValueMemberPath="NomeCliente" ItemTemplate="{StaticResource DataTemplateCliente}" SelectionChanged="txtEntidadeReferencia_SelectionChanged" KeyUp="txtEntidadeReferencia_KeyUp" />
                                            </Grid>
                                        </StackPanel>
                                    </Border>
                                    <Grid Margin="5,-8,0,0" Background="White" VerticalAlignment="Top" HorizontalAlignment="Left" Grid.Column="1" >
                                        <TextBlock x:Name="lblTituloFrameCDS" HorizontalAlignment="Left" Margin="2,0,2,0" Text="{Binding StringLibrary.OpcoesCDS, Source={StaticResource ResolveStrings}}"/>
                                    </Grid>
                                </Grid>

                                <Grid x:Name="gridCurvas" Grid.Row="1" Grid.Column="1" Margin="5,10,0,0">
                                    <Border x:Name="brdCurvas" CornerRadius="5,5,5,5" BorderThickness="1" BorderBrush="#FF5A7194" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                                        <StackPanel>
                                            <Grid Margin="5" Background="White">
                                                <Grid.RowDefinitions>
                                                    <RowDefinition Height="30"/>
                                                    <RowDefinition Height="*" />
                                                </Grid.RowDefinitions>
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition/>
                                                </Grid.ColumnDefinitions>

                                                <StackPanel Orientation="Horizontal" Grid.Row="0">
                                                    <TextBlock Text="Indicador" VerticalAlignment="Center" Margin="0,0,0,0" />
                                                    <ComboBox x:Name="cboTipoIndicador" VerticalAlignment="Center" Width="65" Height="22" Margin="5,0,0,0" />

                                                    <TextBlock Text="Moeda" VerticalAlignment="Center" Margin="15,0,0,0" />
                                                    <slr:AutoCompleteBoxFix x:Name="cboMoedaCurva" VerticalAlignment="Center" 
                                                                            Width="100" Height="22" Margin="5,0,0,0"
                                                                            IsTextCompletionEnabled="True"
                                                                            ValueMemberPath="cd_Moeda"
                                                                            ItemTemplate="{StaticResource DataTemplateMoeda}" />
                                                    <!--<sdk:AutoCompleteBox.ItemTemplate>
                                                            <DataTemplate>
                                                                <StackPanel Orientation="Vertical" Width="200" >
                                                                    <TextBlock Text="{Binding Mode=TwoWay, Path=cd_Moeda}"/>
                                                                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                                                                        <TextBlock Text="{Binding Mode=TwoWay, Path=nm_Moeda}" FontSize="9" Foreground="Blue" />
                                                                        <TextBlock Text=":" FontSize="9" Foreground="Blue" Margin="3,0,0,0"/>
                                                                        <TextBlock Text="{Binding Mode=TwoWay, Path=ValorCotacao}" FontSize="9" Foreground="Blue" Margin="10,0,0,0"/>
                                                                    </StackPanel>
                                                                </StackPanel>
                                                            </DataTemplate>
                                                        </sdk:AutoCompleteBox.ItemTemplate>
                                                    </slr:AutoCompleteBoxFix>-->

                                                    <TextBlock Text="Indexador" VerticalAlignment="Center" Margin="15,0,0,0" />
                                                    <slr:AutoCompleteBoxFix x:Name="cboIndexador" VerticalAlignment="Center" 
                                                                         Width="100" Height="22" Margin="5,0,0,0"
                                                                         ValueMemberPath="Codigo">
                                                        <sdk:AutoCompleteBox.ItemTemplate>
                                                            <DataTemplate>
                                                                <StackPanel Orientation="Vertical" Width="200" >
                                                                    <TextBlock Text="{Binding Mode=TwoWay, Path=Codigo}"/>
                                                                    <StackPanel Orientation="Horizontal" HorizontalAlignment="left">
                                                                        <TextBlock Text="{Binding Mode=TwoWay, Path=Descricao}" FontSize="9" Foreground="Blue" TextWrapping="Wrap" />
                                                                    </StackPanel>
                                                                </StackPanel>
                                                            </DataTemplate>
                                                        </sdk:AutoCompleteBox.ItemTemplate>
                                                    </slr:AutoCompleteBoxFix>

                                                    <Button x:Name="btnIncluirCurva" VerticalAlignment="Center" HorizontalAlignment="Left" 
                                                            Height="22" Width="30" Margin="5,0,0,0" 
                                                            Click="btnIncluirCurva_Click">
                                                        <StackPanel>
                                                            <Image x:Name="imgBtnIncluirCurva" Source="{StaticResource IconeAdicionar}" Height="15" />
                                                        </StackPanel>
                                                    </Button>
                                                </StackPanel>

                                                <sdk:DataGrid x:Name="dataGridCurvas" Grid.Row="1" Grid.Column="0" AutoGenerateColumns="False" 
                                                              Width="510" MinHeight="105" MaxHeight="185" Margin="0" HorizontalAlignment="Left" VerticalAlignment="Stretch"
                                                              ItemsSource="{Binding Curvas}" FontSize="10" >
                                                    <sdk:DataGrid.Columns>
                                                        <sdk:DataGridTextColumn Header="IdCurva" Binding="{Binding IdCurva}" Width="1" Visibility="Collapsed"  />
                                                        <sdk:DataGridTextColumn Header="IdIndicador" Binding="{Binding IdTipoIndicador}"  Width="1" Visibility="Collapsed" />
                                                        <sdk:DataGridTextColumn Header="IdOperacao" Binding="{Binding IdOperacao}" Width="1" Visibility="Collapsed" />
                                                        <sdk:DataGridTextColumn Header="Indicador" Binding="{Binding DescricaoTipoIndicador}" Width="70" IsReadOnly="True" CellStyle="{StaticResource DataGridCellStyle}" />
                                                        <sdk:DataGridTextColumn Header="Moeda" Binding="{Binding Path=Moeda}" Width="55" IsReadOnly="True" CellStyle="{StaticResource DataGridCellStyle}"/>
                                                        <sdk:DataGridTextColumn Header="Indexador" Binding="{Binding Indexador}" Width="85" IsReadOnly="True" CellStyle="{StaticResource DataGridCellStyle}"/>

                                                        <sdk:DataGridTextColumn Binding="{Binding TaxaCorrecao, Converter={StaticResource DecimalConverter}}" Width="85">
                                                            <sdk:DataGridTextColumn.HeaderStyle>
                                                                <Style TargetType="dgPrimitives:DataGridColumnHeader">
                                                                    <Setter Property="ContentTemplate">
                                                                        <Setter.Value>
                                                                            <DataTemplate>
                                                                                <TextBlock Text="{Binding StringLibrary.correcao, Source={StaticResource ResolveStrings}, StringFormat='Tx. \{0\}'}"/>
                                                                            </DataTemplate>
                                                                        </Setter.Value>
                                                                    </Setter>
                                                                </Style>
                                                            </sdk:DataGridTextColumn.HeaderStyle>
                                                        </sdk:DataGridTextColumn>

                                                        <!--<sdk:DataGridTextColumn Header="{Binding StringLibrary.Correcao, Source={StaticResource ResolveStrings}, StringFormat='Tx. \{0\}'}" 
                                                                                Binding="{Binding TaxaCorrecao, Converter={StaticResource DecimalConverter}}" Width="90" />-->
                                                        <sdk:DataGridTextColumn Header="% Indexador" Binding="{Binding PercentualIndexador, Converter={StaticResource DecimalConverter}}"  Width="85" />
                                                        <sdk:DataGridTextColumn Header="Valor Curva" Binding="{Binding ValorContabil, Converter={StaticResource DecimalConverter}}" Width="95" />
                                                        <sdk:DataGridTextColumn Header="Valor MTM" Binding="{Binding ValorMTM, Converter={StaticResource DecimalConverter}}" Width="95" />
                                                        <sdk:DataGridTemplateColumn>
                                                            <sdk:DataGridTemplateColumn.CellTemplate>
                                                                <DataTemplate>
                                                                    <Button x:Name="btnExcluirCurva" Click="btnExcluirCurva_Click" IsEnabled="{Binding IsEnabled, ElementName=btnIncluirCurva}" >
                                                                        <Image Source="{StaticResource IconeRemover}" Width="16" Height="16"/>
                                                                    </Button>
                                                                </DataTemplate>
                                                            </sdk:DataGridTemplateColumn.CellTemplate>
                                                        </sdk:DataGridTemplateColumn>
                                                    </sdk:DataGrid.Columns>
                                                </sdk:DataGrid>
                                            </Grid>
                                        </StackPanel>
                                    </Border>
                                    <Grid Margin="5,-8,0,0" Background="White" VerticalAlignment="Top" HorizontalAlignment="Left" >
                                        <TextBlock x:Name="lblTituloFrameCurvas" Text="Curvas" HorizontalAlignment="Left" Margin="2,0,2,0" />
                                    </Grid>
                                </Grid>
                            </Grid>

                            <StackPanel Grid.Row="2" Grid.ColumnSpan="2">
                                <Border x:Name="brdRodape" BorderBrush="#FF5A7194" CornerRadius="5,5,5,5" BorderThickness="1" Margin="0,3,0,0" Height="43">
                                    <StackPanel>
                                        <Grid Name="gridRodape" Margin="5,3">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="50*" />
                                                <ColumnDefinition Width="50*" />
                                            </Grid.ColumnDefinitions>
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="18" />
                                                <RowDefinition Height="18" />
                                            </Grid.RowDefinitions>

                                            <StackPanel x:Name="panelUsuarioInc" Grid.Row="0" Grid.Column="0" Orientation="Horizontal">
                                                <TextBlock Grid.Row="0" VerticalAlignment="Center" FontWeight="Bold" FontSize="10" Width="80" Margin="5,0,0,0" 
                                                           Text="{Binding StringLibrary.Incluido, Source={StaticResource ResolveStrings}, StringFormat='\{0\} por:' }"/>
                                                <TextBlock x:Name="lblUsuarioIncluiu" Text="{Binding Path=UsuarioIncluiu}" VerticalAlignment="Center" FontSize="10" Margin="5,0,0,0" MinWidth="400" />
                                            </StackPanel>
                                            <TextBlock x:Name="lblDataInclusao" Text="" FontSize="10" Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" Margin="5,0,0,0" />

                                            <StackPanel x:Name="panelUsuarioAlt" Grid.Row="1" Grid.Column="0" Orientation="Horizontal">
                                                <TextBlock Text="Alterado por:" VerticalAlignment="Center" FontWeight="Bold" FontSize="10" Width="80" Margin="5,0,0,0" />
                                                <TextBlock x:Name="lblUsuarioAlterou" Text="{Binding Path=UsuarioAlterou}" VerticalAlignment="Center" FontSize="10" Margin="5,0,0,0" MinWidth="400" />
                                            </StackPanel>
                                            <TextBlock x:Name="lblDataAlteracao" Text="" FontSize="10" Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Margin="5,0,0,0" />
                                        </Grid>
                                    </StackPanel>
                                </Border>
                            </StackPanel>
                        </Grid>
                    </StackPanel>
                </Grid>
                <slc:ControlMenuBar x:Name="barraMenu" Grid.Row="4" BorderRadius="15,0,15,0" VisibilityUserPanel="Collapsed" Background="{StaticResource BlueStrong}" Margin="0,-15,0,0" VerticalAlignment="Top"/>
            </Grid>
        </toolkit:BusyIndicator>
    </Grid>
</controls:ChildWindow>